﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.model.Instance;
using l1cs.server.model;
using l1cs.server.serverpackets;

namespace l1cs.server.clientpackets
{
    public class C_Party : ClientBasePacket
    {
        private const String _C_PARTY = "[C] C_Party";
        private static Logger _log = Logger.getLogger( typeof( C_Party ).FullName );

        public C_Party( byte[] abyte0, ClientThread clientthread )
            : base( abyte0 )
        {
            L1PcInstance pc = clientthread.getActiveChar();
            if ( pc.isGhost() )
            {
                return;
            }
            L1Party party = pc.getParty();
            if ( pc.isInParty() )
            {
                pc.sendPackets( new S_Party( "party", pc
                        .getId(), party.getLeader().getName(), party
                        .getMembersNameList() ) );
            }
            else
            {
                pc.sendPackets( new S_ServerMessage( 425 ) ); // パーティーに加入していません。
                // pc.sendPackets(new S_Party("party", pc
                // .getId()));
            }
        }

        override
        public String getType()
        {
            return _C_PARTY;
        }
    }
}